package
{
  import flash.events.Event;
  import flash.events.EventDispatcher;
  
  import mx.collections.ArrayCollection;
  import mx.collections.ICollectionView;

  public class Bookmark extends EventDispatcher
  {
    private var _id:int;
    private var _url:String;
    private var _name:String;
    private var _type:int;
    private var _description:String;
    private var _children:ArrayCollection;

    public function Bookmark(id:int = 0, url:String = "", name:String = "", type:int = 1, description:String = "", children:ArrayCollection = null)
    {
      _id = id;
      _url = url;
      _name = name;
      _type = type;
      _description = description;
      _children = children;
    }

    [Bindable("idChanged")]
    public function get id():int
    {
      return _id;
    }
    public function set id(id:int):void
    {
      _id = id;
      dispatchEvent(new Event("idChanged"));
    }

    [Bindable("urlChanged")]
    public function get url():String
    {
      return _url;
    }
    public function set url(url:String):void
    {
      _url = url;
      dispatchEvent(new Event("urlChanged"));
    }

    [Bindable("nameChanged")]
    public function get name():String
    {
      return _name;
    }
    public function set name(name:String):void
    {
      _name = name;
      dispatchEvent(new Event("nameChanged"));
    }

    [Bindable("typeChanged")]
    public function get type():int
    {
      return _type;
    }
    public function set type(type:int):void
    {
      _type = type;
      dispatchEvent(new Event("typeChanged"));
    }

    [Bindable("typeChanged")]
    public function get extension():String
    {
      return BookmarkType.stringOf(_type);
    }

    [Bindable("descriptionChanged")]
    public function get description():String
    {
      return _description;
    }
    public function set description(description:String):void
    {
      _description = description;
      dispatchEvent(new Event("descriptionChanged"));
    }

    [Bindable("childrenChanged")]
    public function get children():ArrayCollection
    {
      return _children;
    }
    public function set children(children:ArrayCollection):void
    {
      _children = children;
      dispatchEvent(new Event("childrenChanged"));
    }

  }
}